<!DOCTYPE html>
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
      lang="zh-CN"
      xmlns:th="http://www.thymeleaf.org"
      xmlns="http://www.w3.org/1999/xhtml" layout:decorate="~{layout/template}">
<head>
    <title>新增</title>
    <link rel="stylesheet" href="/css/cms/content/add.css"/>
</head>
<body>
<div id="contentContainer" layout:fragment="content" class="contentContainer navItem" v-cloak>

    <el-row>
        <el-col :span="18" :offset="4">
            <el-form :model="form" :rules="rules" ref="form" label-width="80px">
                <input type="hidden" id="contentId" th:value="${contentId}"/>

                <el-form-item label="选择栏目" prop="channelIdList">
                    <el-cascader
                            :show-all-levels="true"
                            v-model="form.channelIdList"
                            change-on-select
                            :options="options"
                            :props="props">
                    </el-cascader>
                </el-form-item>
                <el-form-item label="标题" prop="title">
                    <el-input v-model="form.title"></el-input>
                </el-form-item>
                <el-form-item label="标题图片">
                    <el-upload
                            name="upload"
                            class="title-img-uploader"
                            :action="uploadImageUrl"
                            :show-file-list="false"
                            :on-success="uploadTitleImgSuccess">
                        <img v-if="form.titleImg" :src="form.titleImg" class="title-img">
                        <i v-else class="el-icon-plus title-img-uploader-icon"></i>
                    </el-upload>
                </el-form-item>
                <el-form-item label="摘要">
                    <el-input type="textarea" :rows="3" v-model="form.description"></el-input>
                </el-form-item>
                <el-form-item label="作者">
                    <el-input v-model="form.author"></el-input>
                </el-form-item>
                <el-form-item label="来源">
                    <el-input v-model="form.origin"></el-input>
                </el-form-item>
                <el-form-item label="来源地址">
                    <el-input v-model="form.originUrl"></el-input>
                </el-form-item>
                <el-form-item label="置顶级别">
                    <el-input-number v-model="form.topLevel" :controls="true" :min="0" :max="99"></el-input-number>
                    <span class="tip">默认0不置顶</span>
                </el-form-item>
                <el-form-item label="发布日期" prop="releaseDate">
                    <el-date-picker
                            v-model="form.releaseDate"
                            value-format="yyyy-MM-dd HH:mm:ss"
                            type="datetime"
                            placeholder="选择发布日期">
                    </el-date-picker>
                </el-form-item>
                <el-form-item label="内容">
                    <el-input name="contentEditor" id="contentEditor" type="textarea"></el-input>
                </el-form-item>
                <el-form-item label="附件">
                    <el-upload
                            name="upload"
                            class="file-uploader"
                            :action="uploadFileUrl"
                            multiple
                            :on-remove="onAttachmentRemove">
                        <el-button size="small" type="success">点击上传</el-button>
                        <div slot="tip" class="el-upload__tip">文件大小不能超过10MB</div>
                    </el-upload>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="submitForm('form')">立即创建</el-button>
                    <el-button @click="resetForm('form')">重置</el-button>
                </el-form-item>
            </el-form>
        </el-col>
    </el-row>

</div>

<th:block layout:fragment="staticFile">
    <script src="/plugins/ckeditor_4.10.0_full/ckeditor.js"></script>
    <script src="/js/cms/content/add.js"></script>
</th:block>

</body>
</html>